home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-05 / driverss.zip / NCRET105.ASM < prev    next >
Assembly Source File  |  1991-01-27  |  5KB  |  211 lines

  1. version    equ    0
  2.  
  3.     include    defs.asm
  4.  
  5. ;Ported from Tim Krauskopf's micnet.asm, an assembly language
  6. ;driver for the MICOM-Interlan NI5210, by Russell Nelson.  Any bugs
  7. ;are due to Russell Nelson.
  8. ;Updated to version 1.08 Feb. 17, 1989 by Russell Nelson.
  9. ;Updated to support 1500 byte MTU April 27, 1989 By Brad Clements.
  10.  
  11. ;  Copyright, 1988, 1989, Russell Nelson
  12.  
  13. ;   This program is free software; you can redistribute it and/or modify
  14. ;   it under the terms of the GNU General Public License as published by
  15. ;   the Free Software Foundation, version 1.
  16. ;
  17. ;   This program is distributed in the hope that it will be useful,
  18. ;   but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. ;   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20. ;   GNU General Public License for more details.
  21. ;
  22. ;   You should have received a copy of the GNU General Public License
  23. ;   along with this program; if not, write to the Free Software
  24. ;   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  25.  
  26. code    segment    word public
  27.     assume    cs:code, ds:code
  28.  
  29. ;
  30. ;  Equates for controlling the ubnicps2 board
  31. ;
  32. SCR        equ    byte ptr 0ffffh
  33. SCR_GREEN    equ    1
  34. SCR_CA        equ    2
  35. SCR_LOOPBACK    equ    4
  36. SCR_RESET    equ    8
  37.  
  38. ;
  39. ;  Data segment
  40. ;
  41.  
  42.     public    int_no
  43. int_no        db    3,0,0,0        ; interrupt number. 
  44. base_addr    dw      0d000h,0    ; base segment for board (jumper set)
  45. enet_addr    db    EADDR_LEN dup(?)
  46.  
  47.     public    driver_class, driver_type, driver_name, driver_function, parameter_list
  48. driver_class    db    BLUEBOOK, IEEE8023, 0        ;from the packet spec
  49. driver_type    db    11        ;from the packet spec
  50. driver_name    db    "NCR ET105",0    ;name of the driver.
  51. driver_function    db    2
  52. parameter_list    label    byte
  53.     db    1    ;major rev of packet driver
  54.     db    9    ;minor rev of packet driver
  55.     db    14    ;length of parameter list
  56.     db    EADDR_LEN    ;length of MAC-layer address
  57.     dw    GIANT    ;MTU, including MAC headers
  58.     dw    MAX_MULTICAST * EADDR_LEN    ;buffer size of multicast addrs
  59.     dw    0    ;(# of back-to-back MTU rcvs) - 1
  60.     dw    0    ;(# of successive xmits) - 1
  61. int_num    dw    0    ;Interrupt # to hook for post-EOI
  62.             ;processing, 0 == none,
  63.  
  64. enable_network:
  65. ;  connect to network
  66.     push    es
  67.     mov    es,base_addr
  68.     or    es:[SCR],SCR_LOOPBACK
  69.     pop    es
  70.     ret
  71.  
  72.  
  73. reset_586:
  74. ;  Reset the chip
  75.     push    es
  76.     mov    es,base_addr
  77.     or    es:[SCR],SCR_RESET
  78.     jmp    $+2
  79.     jmp    $+2
  80.     jmp    $+2
  81.     jmp    $+2
  82.     and    es:[SCR],not SCR_RESET
  83.     pop    es
  84.     ret
  85.  
  86.  
  87.     public    get_address
  88. get_address:
  89. ;get the address of the interface.
  90. ;enter with es:di -> place to get the address, cx = size of address buffer.
  91. ;exit with nc, cx = actual size of address, or cy if buffer not big enough.
  92.     assume    ds:code
  93.     cmp    cx,EADDR_LEN        ;make sure that we have enough room.
  94.     jb    get_address_2
  95.     mov    cx,EADDR_LEN
  96.     mov    si,offset enet_addr
  97.     rep    movsb
  98.     mov    cx,EADDR_LEN
  99.     clc
  100.     ret
  101. get_address_2:
  102.     stc
  103.     ret
  104.  
  105.  
  106. doca:
  107. ;we may be called from places in which ds is unknown.
  108.     assume    ds:nothing
  109.     push    es
  110.     mov    es,base_addr
  111.     or    es:[SCR],SCR_CA
  112.     and    es:[SCR],not SCR_CA
  113.     xor    es:[SCR],SCR_GREEN    ;blink the led on each CA.
  114.     pop    es
  115.     ret
  116.     assume    ds:code
  117. ;yet, we really should assume ds==code for the rest of this stuff.
  118.  
  119. ;
  120. ; Here we include the code that is common between 82586 implementations.
  121. ; Everything above this is resident.
  122.     include    82586.asm
  123. ; Everything below this is discarded upon installation.
  124.  
  125.     public    usage_msg
  126. usage_msg    db    "usage: ncret105 [-n] [-d] [-w] <packet_int_no> <int_no> <base_addr> <Ethernet_address>",CR,LF,'$'
  127.  
  128.     public    copyright_msg
  129. copyright_msg    db    "Packet driver for the NCR ET105, version ",'0'+majver,".",'0'+version,".",'0'+i82586_version,CR,LF
  130.         db    "Portions Copyright 1988 The Board of Trustees of the University of Illinois",CR,LF,'$'
  131.  
  132. no_mem_msg    db    "No ET 105 found at ",'$'
  133. no_eaddr_msg    db    "You must specify an Ethernet address for the ET 105",CR,LF
  134.         db    "Your card came with a pre-printed label giving the address assigned",CR,LF
  135.         db    "to this card.",CR,LF,'$'
  136.  
  137. check_board:
  138.     mov    SCP,0            ;16-bit bus internally.
  139.     mov    ax,base_addr
  140.     mov    cx,4000h-1        ;test all 16K minus the SCR.
  141.     call    memory_test
  142.     jz    have_mem
  143.     pop    dx            ;drop our return address
  144.     mov    di,offset base_addr
  145.     mov    dx,offset no_mem_msg
  146.     call    print_number
  147.     stc
  148.     ret
  149. have_mem:
  150.     mov    si,offset enet_addr
  151.     mov    cx,EADDR_LEN
  152.     xor    ah,ah
  153. check_eaddr:
  154.     lodsb
  155.     or    ah,al
  156.     loop    check_eaddr
  157.     or    ah,ah            ;did we have all zeroes?
  158.     jne    have_eaddr
  159.     pop    dx            ;return to the caller of etopen.
  160.     mov    dx,offset no_eaddr_msg    ;print this error first, though.
  161.     mov    ah,9
  162.     int    21h
  163.     stc
  164.     ret
  165. have_eaddr:
  166.     ret
  167.  
  168.  
  169.     public    parse_args
  170. parse_args:
  171.     mov    di,offset int_no
  172.     call    get_number
  173.     mov    di,offset base_addr
  174.     call    get_number
  175.     push    ds
  176.     pop    es
  177.     mov    di,offset enet_addr
  178.     call    get_eaddr
  179.     clc
  180.     ret
  181.  
  182.  
  183. int_no_name    db    "Interrupt number ",'$'
  184. base_addr_name    db    "Memory address ",'$'
  185.  
  186.  
  187.     public    print_parameters
  188. print_parameters:
  189.     mov    di,offset int_no
  190.     mov    dx,offset int_no_name
  191.     call    print_number
  192.     mov    ax,memory_begin
  193.     mov    cl,4
  194.     shr    ax,cl
  195.     add    base_addr,ax
  196.     push    ax
  197.     mov    di,offset base_addr
  198.     mov    dx,offset base_addr_name
  199.     call    print_number
  200.     pop    ax
  201.     sub    base_addr,ax
  202.     ret
  203.  
  204.     include    memtest.asm
  205.     extrn    get_hex: near
  206.     include    getea.asm
  207.  
  208. code    ends
  209.  
  210.     end
  211.